package Month11.Day8;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;

public class ListMethod {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<>();
        Student s1 = new Student("小甲", 20);
        Student s2 = new Student("小乙", 18);
        /*
                    boolean add(Object o)
         */
        list.add(s1);
        list.add(s2);
        /*
                    void add(int index,Object o)
         */
        Student s3 = new Student("小并", 19);
        list.add(1, s3);
        /*
                    int size()
         */
        System.out.println(list.size());
        /*
                    Object get(int index)
         */
        System.out.println(list.get(1));
        /*
                    void set(int index,Object obj)
         */
           Student s4=new Student("小花",18);
        System.out.println(list.set(1,s4));
        /*
                   boolen contains(Object o)
         */
        System.out.println(list.contains(s1));
        /*
                   int indexOf(Object o)
         */
        System.out.println(list.indexOf(s2));
        /*
                   boolean remove(Object o)
         */
        System.out.println(list.remove(s1));
        /*
                    Object remove(int index)
         */
        System.out.println(list.remove(1));
        for (Student student : list)
            System.out.println(student);


    }


}









